package com.zm.config.oss;

import com.zm.common.util.oss.OssBootUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

/**
 * @version 1.0
 * @ ClassName OssBootConfiguration
 * <p> oss bean配置
 * @ author 王志明
 * @ Date 2020/11/12 9:11
 */
public class OssBootConfiguration {
    @Value("${zm.oss.endpoint}")
    private String endpoint;
    @Value("${zm.oss.accessKey}")
    private String accessKeyId;
    @Value("${zm.oss.secretKey}")
    private String accessKeySecret;
    @Value("${zm.oss.bucketName}")
    private String bucketName;
    @Value("${zm.oss.staticDomain}")
    private String staticDomain;


    @Bean
    public void initOssBootConfiguration() {
        OssBootUtil.setEndPoint(endpoint);
        OssBootUtil.setAccessKeyId(accessKeyId);
        OssBootUtil.setAccessKeySecret(accessKeySecret);
        OssBootUtil.setBucketName(bucketName);
        OssBootUtil.setStaticDomain(staticDomain);
    }
}
